{extend name="user_base" /} {block name="seo"}
<title>我的信息 - {$site_config['seo_title']}</title>
<meta name="keywords" content="{$site_config['seo_keyword']}">
<meta name="description" content="{$site_config['seo_description']}">
{/block}
{block name="css"}

{/block}
{block name="main"}
<div class="i-info layui-clear">
    <a class="info-img">
        <img src="{$user.avatar}" onerror="this.src='__HOME__/images/a3o.png'" />
    </a>
    <div class="info-info">
        <h3 class="nick"><i class="iconfont icon-nan"></i>{$user.nickname}<font>{$user.uuid}</font><b class="jp">{$user.designation}</b></h3>
        <p class="intr">{$user.description}</p>
    </div>
</div>
<div class="title"> 概括数据 </div>
<div class="gaikuo layui-clear">
    <b>{$user.posted_num}</b>
    <b>{$user.passed_num}</b>
    <b>{$user.comment_num}</b>
    <b>{$user.praise_num}</b>
    <b class="bx"><img src="__HOME__/images/tg.png" />投稿</b>
    <b class="bx"><img src="__HOME__/images/sh.png" />通过</b>
    <b class="bx"><img src="__HOME__/images/pl.png" />评论</b>
    <b class="bx"><img src="__HOME__/images/dz.png" />获赞</b>
</div>
<div class="title"> 我的信息 </div>
<ul class="my-info">
    <li>
        <h3>用户名</h3>
        <span>{$user.username}</span>
    </li>
    <li>
        <h3>我的昵称</h3>
        <span>{$user.nickname}</span>
    </li>
    <li>
        <h3>介绍</h3>
        <span>{$user.description}</span>
    </li>
    <li>
        <h3>当前级别</h3>
        <span class="jp">{$user.designation}</span>
    </li>
    <li>
        <h3>性别</h3>
        <span>{if $user.sex eq 1}女{else /}男{/if}</span>
    </li>
    <li>
        <h3>我的QQ</h3>
        <span><?php echo $user['qq_id']?substr_replace($user['qq_id'], '*****', -2, 3):'---'; ?></span>
    </li>
    <li>
        <h3>邮箱号码</h3>
        <span><?php echo $user['email']?substr_replace($user['email'], '********', -7, 4):'暂未绑定'; ?></span>
    </li>
    <li>
        <h3>手机号码</h3>
        <span><?php echo $user['email']?substr_replace($user['mobile'], '********', -2, 4):'暂未绑定'; ?></span>
    </li>
    <li>
        <h3>注册时间</h3>
        <span>{$user.created_at}</span>
    </li>
    <li>
        <h3>我的ID </h3>
        <span>{$user.uuid}</span>
    </li>
</ul>
<a href="/user/changeinfo.html" class="goChange">修改资料</a>
{/block}
{block name="script"}
<script>
    var layer;
    layui.use(['layer','upload'], function(){
        layer = layui.layer;
        var upload = layui.upload;

        /* 级别的解释 */
        $(".jp").hover(function(e){
            layer.tips('普通会员：指正常用户<br/>投稿作者：分享投稿过的<br/>金牌作者：长期投稿 并享有极高通过率的作者，此类作者可享受本站优先通过和自动审核通过的特权', $(this),{
                tips: [1, '#2c2c2c'],
                area:['310px'],
                time:0
            });
        },function(e){
            layer.closeAll();
        });

        /*更换头像*/
        var uploadInst = upload.render({
            elem: '.info-img' ,
            auto: false,
            choose: function(obj){
                var files = obj.pushFile();
                obj.preview(function(index, file, result){
                    files = result;
                });
                layer.open({
                    type: 2,
                    shadeClose:true,
                    acceptMime:'image/*',
                    title:"头像裁剪",
                    area:['400px','397px'],
                    skin: 'atuikeLayerSkin1 trim',
                    content:[config.api.trim, 'no'],
                    btn:0,
                    success:function(layero, index){
                        document.getElementById("layui-layer-iframe" + index).contentWindow.selectImg(files);
                    },
                    //end:location.reload
                });
            }
        });
    });

    function setImgData(base64) {
        request({
            data:{user_head:encodeURIComponent(base64)},
            success:function (result) {
                if (result.code){
                    layer.closeAll();
                    $('.info-img').find("img")[0].src=result.data.src+"?_="+new Date().getTime();
                }else{
                    layer.msg(result.msg)
                }
            }
        });
    }
</script>
{/block}